package com.zdp.sources.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdp.sources.pojo.User;
import com.zdp.sources.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author sesshomaru
 * @date 2022/2/28
 */
@RestController
@RequestMapping("/dev")
public class DevController {

    @Autowired
    private UserService userService;

    @GetMapping("/find")
    public Page<User> find(@RequestParam(value = "size", required = false, defaultValue = "1")Integer size) {
        Page<User> page = new Page<>(1, size);
        return page.setRecords(userService.select(page));
    }

    @GetMapping("/insert/{name}")
    public boolean insert(@PathVariable("name")String name) {
        return userService.insert(name);
    }
}
